package com.chenfan.mcn.model.dto;

import com.chenfan.mcn.model.rpc.AbstractFinanceCallback;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 财务金额回调DTO
 *
 * @author wulg
 * @date 2022-08-04
 **/
@NoArgsConstructor
@Data
public class IncomeContarctCallbackDTO implements Serializable {

    /**
     * 回调的财务单据号
     */
    private String billNo;

    /**
     * 回调金额
     */
    private BigDecimal amount;

    /**
     * 收入合同单据ID
     */
    private Long incomeContractId;

    /**
     * 最近回款时间
     */
    private Date paybackDate;

    /**
     * 操作人ID
     */
    private Long operatorId;

    /**
     * 操作人名称
     */
    private String operatorName;

    /**
     * 操作日期
     */
    private Date operateDate;

    /**
     * 租户ID
     */
    private Long tenantId;

    /**
     * 最新回款状态
     */
    private Integer newestPaybackStatus;

    public IncomeContarctCallbackDTO(AbstractFinanceCallback financeCallback, String billNo, BigDecimal amount, Long incomeContractId) {
        this(financeCallback, billNo, amount, incomeContractId, null);
    }

    public IncomeContarctCallbackDTO(AbstractFinanceCallback financeCallback, String billNo, BigDecimal amount, Long incomeContractId, Date paybackDate) {
        this.billNo = billNo;
        this.amount = amount;
        this.incomeContractId = incomeContractId;
        this.operatorId = financeCallback.getOperatorId();
        this.operatorName = financeCallback.getOperatorName();
        this.operateDate = financeCallback.getOperateDate();
        this.tenantId = financeCallback.getTenantId();
        this.paybackDate = paybackDate;
    }
}
